package com.fitnessapp.user;

import java.util.List;
import java.util.Map;

import android.database.Cursor;
import android.graphics.Bitmap;

import com.fitnessapp.database.DatabaseHelper;
import com.fitnessapp.database.DatabaseStrings;
import com.fitnessapp.database.MySqlHelper;
import com.fitnessapp.database.RemoteStorageConnection;

public class UserExercise {

	private int exerciseId;
	private String desc;
	private String name;
	private String notes;
	private int dayOfWeek;
	private int sets;
	private int reps;
	private Bitmap bitmap;	
	
	public UserExercise() {
	}

	public String getName() {
		// TODO Auto-generated method stub
		return null;
	}

	public void load(MySqlHelper dbHelper) {
		
//		List<Map<String,String>> result = dbHelper.query(
//				"exercise_name, exercise_media1, exercise_desc",
//				DatabaseStrings.EXERCISE_TABLE,
//				"exercise_id = \'" + exerciseId +"\'");
//		
//		if( result.size() > 0 ){
//			Map<String,String> exerciseData = result.get(0);
//			
//			desc = exerciseData.get("exercise_desc");
//			name = exerciseData.get("exercise_name");
//			bitmap = RemoteStorageConnection.downloadImage("http://brettsgameportfolio.com/" + exerciseData.get("exercise_media1"));
//		}
		
	}

	public Bitmap getMedia() { return bitmap; }
	public String getDescription() { return desc; }

	public void createFromCursor(Cursor cursor) {
		this.exerciseId = cursor.getInt(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_ID));
		this.name = cursor.getString(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_NAME));
		this.desc = cursor.getString(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_DESCRIPTION));
		this.notes = cursor.getString(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_NOTES));
		this.sets = cursor.getInt(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_SETS));
		this.reps = cursor.getInt(cursor.getColumnIndex(DatabaseHelper.EXERCISE_TABLE_REPS));
		
	}

	public int getDayOfWeek() { return dayOfWeek; }

}
